package com.xigege.netty.TCPStickyBag.solve.useProtocol.client;

import com.xigege.netty.TCPStickyBag.solve.useProtocol.MyMessageDecoder;
import com.xigege.netty.TCPStickyBag.solve.useProtocol.MyMessageEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new MyMessageEncoder()); //加入我们自己的编码器
        pipeline.addLast(new MyMessageDecoder());
        pipeline.addLast(new MyClientHandler());
    }
}
